package com.iflyun.person.dao.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;

import com.iflyun.person.dao.TestService;
import com.iflyun.person.entity.WebLog;

@Service
public class TestServiceImpl implements TestService {

	
	@Autowired
	private JdbcTemplate jdbcTemplate;
	
	@Override
	public Integer getAllWebLogs() {
		int i=jdbcTemplate.queryForObject("select count(1) from t_log_detail_web_temp", Integer.class);
		return i;
	}

	@Override
	public WebLog findById(String id) {
		System.out.println("缓存"+id);
		Object[] param={id};
		return  jdbcTemplate.queryForObject("select t.ID id,t.USERID userId ,t.Ip ip ,t.PROXY_IP proxyIp from t_log_detail_web_temp t  where t.id=?",
				new BeanPropertyRowMapper<WebLog>(WebLog.class) , 
				param);
	
	}

}
